#include "TradingSystem.h"
#include "TradeEvent.h"

void TradingSystem::Add(std::shared_ptr<IStrategy>& strategy)
{
	_strategies.push_back(strategy);
}

void TradingSystem::VisitStrategy(const ITradeEvent& event)
{
	for (auto strategy : _strategies)
	{
		event.Accept(*strategy);
	}
}

void TradingSystem::Run()
{
	auto eventTick = EventTick();
	VisitStrategy(eventTick);

	auto eventOrder = EventOrder();
	VisitStrategy(eventOrder);

	auto eventTrade = EventTrade();
	VisitStrategy(eventTrade);

	auto eventPosition = EventPosition();
	VisitStrategy(eventPosition);
}
